<?php

namespace app\ruinuo\config\mode;
use app\common\model\RuinuoMode as DataMode;
class Info
{
    public function Model()
    {
        return new DataMode();
    }

    public function ListModel()
    {
        $Model=new DataMode();
        $DB=$Model->alias('a');
        return $DB;
    }

    public function InfoMode()
    {
        $data=[
            'app_id'=>'1',
            'app_num'=>'ruinuo',
            'app_name'=>'低代码',
            'mode_id'=>'2',
            'mode_num'=>'mode',
            'mode_name'=>'模块管理',
            'database'=>'ruinuo_mode',
            'sub_database'=>[],        ];
        return $data;
    }

    public function InfoForm()
    {
        $data=[
            'power_field'=>[
                [
                    'add'=>'',
                    'edit'=>'1',
                    'field'=>'num',
                    'detail'=>'',
                    'role_ids'=>'',
                    'user_ids'=>'',
                    'department_ids'=>'',
                ],
            ],

            'layout'=>[
                [
                    'field'=>'app_id',
                    'title'=>'归属应用',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'app_list',
                ],
                [
                    'field'=>'name',
                    'title'=>'名称',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                ],
                [
                    'field'=>'num',
                    'title'=>'编码',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'isalpha',
                ],
                [
                    'field'=>'database',
                    'title'=>'数据表',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'database_list',
                ],
                [
                    'field'=>'sub_database',
                    'title'=>'关联子表',
                    'value'=>'',
                    'tag'=>'jsontable',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'cols'=>[
                [
                    'field'=>'database',
                    'title'=>'选择数据库',
                    'width'=>'',
                    'update'=>'select',
                    'options'=>'database_list',
                    'minWidth'=>'160',
                    'required'=>'1',
                    'options_num'=>'mode_list',
                ],
                [
                    'field'=>'alias',
                    'title'=>'别名',
                    'update'=>'input',
                    'minWidth'=>'160',
                    'required'=>'1',
                ],
                [
                    'field'=>'type',
                    'title'=>'与模型表关系',
                    'width'=>'',
                    'update'=>'select',
                    'options'=>'guanlian_type',
                    'minWidth'=>'160',
                    'required'=>'1',
                    'options_num'=>'guanlian_type',
                ],
                [
                    'field'=>'sub_field',
                    'title'=>'子表字段',
                    'update'=>'input',
                    'minWidth'=>'160',
                    'required'=>'1',
                ],
                [
                    'field'=>'key_field',
                    'title'=>'主表字段',
                    'update'=>'input',
                    'minWidth'=>'160',
                    'required'=>'1',
                ],
            ],

                ],
            ],
        ];
        return $data;
    }

    public function InfoLists()
    {
        $data=[
            'lists'=>[
                [
                    'name'=>'全部',
                    'num'=>'',
                    'page_num'=>'30',
                    'order_raw'=>'id desc',
                    'power_field'=>[],
                    'power_role'=>'',
                    'power_department'=>'',
                    'set_where'=>'',
                    'table_cols'=>[
                [
                    'field'=>'id',
                    'title'=>'主键',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'app_id',
                    'title'=>'归属应用',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'url',
                    'total'=>'2',
                ],
                [
                    'field'=>'name',
                    'title'=>'名称',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'like',
                    'total'=>'2',
                ],
                [
                    'field'=>'num',
                    'title'=>'编码',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'like',
                    'total'=>'2',
                ],
                [
                    'field'=>'notes',
                    'title'=>'备注',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'database',
                    'title'=>'数据表',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'like',
                    'total'=>'2',
                ],
                [
                    'field'=>'update_id',
                    'title'=>'修改人',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'update_time',
                    'title'=>'修改时间',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'datetime',
                    'total'=>'2',
                ],
            ],

                ],
            ],
        ];
        return !empty($data['lists']) ? $data['lists'] : [];
    }

}